home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / communic / pcmail / main / porting < prev    next >
Encoding:
Text File  |  1994-06-05  |  2.9 KB  |  52 lines

  1. @(#) PORTING 2.1 90/01/22 13:01:09
  2.  
  3. This document gives some hints to people who might consider to port the
  4. programs to an environment different from UNIX or MS-DOS.  Fortunately,
  5. the programs themselves are written in portable (old-style) C. The only
  6. exception is the MS-DOS serial port driver, which isn't portable at all.
  7.  
  8. First of all, search the source files for #ifdef constructs.  This
  9. should give an idea where the system-dependencies lurk.
  10.  
  11. The main problem will be serial-port I/O.  If possible, try to build on
  12. top of what the GNUUCP people have already done in this field.
  13.  
  14. A less severe problem should be console input/output.  The programs do
  15. not use any graphics at all, nor are special input devices such as mice
  16. required.  If your machine provides some kind of vt52 or vt100
  17. emulation, adapt the console.c and tgoto.c files in the termcap
  18. subdirectory.  On machines without some form of text window on the
  19. console, porting will require too much work.  Most keyboards generate
  20. codes that can be easily encoded in the console.c file in the termcap
  21. subdirectory.  Most C compilers provide some form of "raw" keyboard i/o
  22. that does not require the user to press ENTER, and that produces no
  23. echo.  You may wish to consult a UNIX programmer's manual to find out
  24. what the two-letter codes in console.c are all about.
  25.  
  26. Process management may need some attention.  The programs were written
  27. in the UNIX style, i.e. many small programs dedicated to a single task.
  28. Programs invoke other programs.  Each program returns an exit status,
  29. such that the parent program can take appropriate action if things went
  30. wrong.  If your operating system does not provide facilities to invoke,
  31. from with a program, other programs with command-line arguments, you
  32. lose.  Sometimes, programs can only be invoked with the "aid" of a
  33. command-language interpreter.  This often causes the exit status of
  34. programs to be lost; the net result will be less reliable operation of
  35. the pc-mail software.  In the case of MS-DOS I compromised:  batch
  36. command files must be given including their suffix, so that special
  37. arrangements can be made; other programs are invoked directly without
  38. intervention of a command interpreter.
  39.  
  40. File i/o should be taken care of by your C library; make sure that
  41. "text" and "binary" modes are used at the appropriate places.  Just look
  42. up where O_BINARY appears in the source.  If your C library does not
  43. need to distinguish between text and binary file i/o, you are lucky.
  44.  
  45. You will have to provide some form of the Berkeley-UNIX directory
  46. library routines; they allow any program to scan directories for the
  47. names of files.  By now, these routines should be publicly available for
  48. most reasonable operating systems.  Make sure that the version you use
  49. produces file names in lower case (or take appropriate measures), and
  50. that it behaves well even in the root directory of a file system
  51. (MS-DOS doesn't, so I had to compromise again).
  52.